/*    */ package com.infoservice.schedule.util;
/*    */ 
/*    */ import com.infoservice.schedule.Constant;
/*    */ import com.infoservice.schedule.worker.WorkerMng;
/*    */ import java.util.Map;
/*    */ import java.util.Map.Entry;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class RuntimeParameterUtil
/*    */ {
/* 20 */   private static Logger logger = Logger.getLogger(RuntimeParameterUtil.class);
/*    */ 
/*    */   public static void updateRtParams(Map<String, String> rtMap) {
/* 23 */     if ((rtMap == null) || (rtMap.isEmpty())) {
/* 24 */       logger.info("update runtime parameters warn : parameters list is null or is empty !");
/* 25 */       return;
/*    */     }
/* 27 */     logger.debug("parameter list is :" + rtMap);
/* 28 */     for (Map.Entry entry : rtMap.entrySet())
/*    */       try {
/* 30 */         if (((String)entry.getKey()).indexOf("TASK_LOAD_COUNT") != -1) {
/* 31 */           Constant.TASK_LOAD_COUNT = Integer.parseInt((String)entry.getValue());
/* 32 */           logger.debug("TASK_LOAD_COUNT 修改后的值====" + Constant.TASK_LOAD_COUNT);
/*    */         }
/* 34 */         if (((String)entry.getKey()).indexOf("TASK_LOAD_INTERVAL") != -1) {
/* 35 */           Constant.TASK_LOAD_INTERVAL = Long.parseLong((String)entry.getValue());
/* 36 */           logger.debug("TASK_LOAD_INTERVAL 修改后的值====" + Constant.TASK_LOAD_INTERVAL + " 分钟");
/*    */         }
/* 38 */         if (((String)entry.getKey()).indexOf("TASK_GEN_AHEAD_TIME") != -1) {
/* 39 */           Constant.TASK_GEN_AHEAD_TIME = Integer.parseInt((String)entry.getValue()) * 60 * 1000;
/* 40 */           logger.debug("TASK_GEN_AHEAD_TIME 修改后的值====" + Constant.TASK_GEN_AHEAD_TIME / 60000 + " 分钟");
/*    */         }
/* 42 */         if (((String)entry.getKey()).indexOf("WORKER_COUNT") != -1) {
/* 43 */           WorkerMng.getInstance().setWorker(Integer.parseInt((String)entry.getValue()));
/* 44 */           logger.debug("WORKER_COUNT 修改后的值====" + WorkerMng.getInstance().getWorkerNum());
/*    */         }
/* 46 */         if (((String)entry.getKey()).indexOf("WORKER_STATUS_CHECK_INTERVAL") != -1) {
/* 47 */           Constant.WORKER_STATUS_CHECK_INTERVAL = Integer.parseInt((String)entry.getValue());
/* 48 */           logger.debug("WORKER_STATUS_CHECK_INTERVAL 修改后的值====" + Constant.WORKER_STATUS_CHECK_INTERVAL + " 分钟");
/*    */         }
/*    */       } catch (Throwable t) {
/* 51 */         logger.error("update parameter " + (String)entry.getKey() + " error! cause \n" + t.getMessage(), t);
/*    */       }
/*    */   }
/*    */ }

/* Location:           D:\Workspace\Work\ASMP_DE\lib\frame3\InfoSchedule_1.0.03.jar
 * Qualified Name:     com.infoservice.schedule.util.RuntimeParameterUtil
 * JD-Core Version:    0.6.0
 */